<template>
	<view class="page" v-cloak>
		<!-- 自定义头部start -->
		<view class="cu-custom bg-white">
			<view class="cu-bar fixed bg-white" :style="[
            { height: CustomBar + 'px', paddingTop: StatusBar + 'px', backgroundColor: '#fff'+ ')' }
          ]">
				<view class="action" @tap="back"><text class="cuIcon-back"></text></view>
				<view class="content" :style="[{top: StatusBar+'px'}]">
					{{i18n['商品详情']}}
				</view>
				<!-- is_check  0审核中 1通过 2拒绝-->
				<!--非入仓  已上架  已下架 审核失败-->
				<view class="share-btn padding-right" @tap="delSet"
					v-if="(pageType=='upIng'||pageType=='downIng'||(pageType=='reviewIng'&&goodsInfo.is_check==2))&&(userInfo&&userInfo.run_type==2)">
					删除</view>
			</view>
		</view>
		<!-- 审核状态 -->
		<view class="padding-sm relative text-df text-center"
			:class="goodsInfo.is_check==2?'bg-red0 text-red':'bg-theme0 text-theme'"
			v-if="(pageType=='reviewIng'&&goodsInfo.is_check!=1)"
			:style="{top:CustomBar+'px'}">
			<!-- &&(userInfo&&userInfo.run_type==2) -->
			<view>当前状态：{{goodsInfo.is_check==2?'审核失败':'审核中'}}</view>
			<view v-if="goodsInfo.is_check==2" class="margin-top-xs">{{goodsInfo.check_reason}}</view>
		</view>
		<view class="padding-lr padding-top relative " :style="{top:CustomBar+'px'}">
			<view class="">
				<view class="text-df text-666">商品标题</view>
				<view class="text-lg text-333 margin-top-sm">{{goodsInfo.name}}</view>
			</view>
			<view class="margin-top">
				<view class="text-df text-666">商品封面图片</view>
				<image :src="goodsInfo.thumb_url" mode="aspectFill" @tap='preview(goodsInfo.thumb_url,[goodsInfo.thumb_url])'
					class="radius-16 fu-block-160 margin-top-sm"></image>
			</view>
			<view class="margin-top">
				<view class="text-df text-666">商品视频</view>
				<!-- <video :src="goodsInfo.video" class="radius-16 fu-block-160 margin-top-sm"></video> -->
				<view class="relative margin-top-sm" @tap='videoPop=true' v-if="goodsInfo.video!=''">
					<image :src="goodsInfo.video_img" mode="aspectFill" class="radius-16 fu-block-160 "></image>
					<text class="cuIcon-playfill fu-fs42" style="position: absolute;left:9%;top: 34%;"></text>
				</view>
				<view class="margin-top-sm" v-else>
					无
				</view>

			</view>
			<view class="margin-top">
				<view class="text-df text-666">商品轮播图</view>
				<view class="flex align-center margin-top-sm flex-wrap"
					v-if="goodsInfo.images_url&&goodsInfo.images_url.length>0">
					<image :src="item" v-for="(item,index) in goodsInfo.images_url" :key='index' mode="aspectFill"
						@tap='preview(item,goodsInfo.images_url)'
						class="radius-16 bg-f8 fu-block-160 margin-right-16 margin-bottom-sm img-box">
					</image>
				</view>
			</view>
			<view class="margin-top padding-bottom">
				<view class="text-df text-666 margin-bottom-sm">商品详情</view>
				<jyf-parser :html="goodsInfo.body"></jyf-parser>
			</view>
		</view>
		<view class="bg-f8 height-20 w100 relative" :style="{top:CustomBar+'px'}"></view>
		<view class="padding-bottom-120 relative padding-lr" :style="{top:CustomBar+'px'}">
			<view class="padding-tb solid-bottom flex align-center justify-between" @tap="lookGoodsInfo('goods')">
				<view class="text-df text-333 flex-shrink">商品参数</view>
				<text class="cuIcon-right text-999"></text>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between" @tap="lookGoodsInfo('list')">
				<view class="text-df text-333 flex-shrink">包装清单</view>
				<text class="cuIcon-right text-999"></text>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between" @tap="toAccessories()">
				<view class="text-df text-333 flex-shrink">配件商品</view>
				<text class="cuIcon-right text-999"></text>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">平台分类</view>
				<view class=" text-666">{{goodsInfo.cid_name||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">店铺商品分类</view>
				<view class=" text-666">{{goodsInfo.goods_shop_category_name||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">商品货号</view>
				<view class=" text-666">{{goodsInfo.sn||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">商品品牌</view>
				<view class=" text-666">{{goodsInfo.brand_name||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">活动标签</view>
				<view class=" text-666">{{goodsInfo.is_find==1?'发现':''||''}} {{goodsInfo.is_recommend==1?'推荐':''||''}}
					{{goodsInfo.is_hot==1?'热销':''||''}} {{goodsInfo.is_new==1?'新品':''||''}}
				</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">成本价</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(1)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.cost_price||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">售卖价</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(2)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.shop_price||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">主营价格</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(3)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.main_business||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">VIP价格</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(4)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.vip||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">总库存</view>
				<view class=" text-666">{{goodsInfo.stock||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333 flex-shrink ">库存下限</view>
				<view class=" text-666">{{goodsInfo.stock_warning||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">商品属性</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(5)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.attribute||''}}</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">最小起订量 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(6)'></image>
				</view>
				<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.min_reserve}}个</view>
			</view>
			<view class="" v-if="goodsInfo.goods_price&&goodsInfo.goods_price.is_quota==1">
				<view class="padding-tb solid-bottom flex align-center justify-between">
					<view class="text-df text-333     flex align-center flex-shrink ">
						<text class="margin-right-xs">商品限购 </text>
						<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(7)'></image>
					</view>
				</view>
				<view class="padding-tb solid-bottom flex align-center justify-between">
					<view class="text-df text-333     flex align-center flex-shrink ">
						<text class="margin-right-xs">限购数量 </text>
					</view>
					<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.quota_num}}</view>
				</view>
				<view class="padding-tb solid-bottom flex align-center justify-between">
					<view class="text-df text-333     flex align-center flex-shrink ">
						<text class="margin-right-xs">限购时间 </text>
					</view>
					<view class=" text-666">{{goodsInfo.goods_price&&goodsInfo.goods_price.quota_date}}</view>
				</view>
			</view>
			<view class="padding-tb solid-bottom flex align-center justify-between"
				v-if="goodsInfo.goods_price&&goodsInfo.goods_price.is_section==1">
				<view class="text-df text-333     flex align-center flex-shrink ">
					<text class="margin-right-xs">区间价格/数量</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(8)'></image>
				</view>
				<!-- <view class=" text-666">5个</view> -->
			</view>
			<!-- is_section 区间价格开关 is_quota 是否限购 -->
			<view class="" v-for="(item,index) in goodsInfo.ladderList" :key='index'
				v-if="goodsInfo.goods_price&&goodsInfo.goods_price.is_section==1">
				<view class="after-item flex justify-between align-center padding-top ">
					<view class="after_left text-333 flex align-center text-bold text-df ">
						<text class="margin-right-xs">{{item.name}} </text>
					</view>
				</view>
				<view class="after-item flex justify-between align-center padding-tb ">
					<view class="after_left text-333 flex align-center text-df text-weight-400">
						<text class="margin-right-xs">阶梯价格</text>
					</view>
					<view class="flex align-center  text-weight-400 text-df">{{item.price}} </view>
				</view>
				<view class="after-item flex justify-between align-center padding-bottom solid-bottom">
					<view class="after_left margin-right-40 text-333 flex-shrink flex align-center text-df text-weight-400">
						<text class="margin-right-xs ">购买数量</text>
					</view>
					<view class="flex align-center   text-df">{{item.min}}-{{item.max}} </view>
				</view>
			</view>
		</view>
		<!-- 底部菜单start 非入仓 -->
		<view class="tools flex justify-end padding align-center" v-if="userInfo&&userInfo.run_type==2">
			<view v-if="pageType=='upIng'"
				class="radius-100 width-160 margin-right-sm height-56 text-333 bg-f8 text-sm text-center line-height-56"
				@tap='downLoad'>下架 </view>
			<view v-if="pageType=='upIng'||pageType=='downIng'"
				class="radius-100 width-160 margin-right-sm height-56 text-333 bg-f8 text-sm text-center line-height-56"
				@tap='lookEval'>查看评价 </view>
			<!-- 下架状态 -->
			<view v-if="pageType=='downIng'"
				class="radius-100 width-160 margin-right-sm height-56 text-333 bg-f8 text-sm text-center line-height-56"
				@tap='editGoods'>编辑 </view>
			<view class="radius-100 width-160  height-56 text-white bg-theme1 text-sm text-center line-height-56"
				v-if="pageType=='downIng'" @tap='openPop'
				:class="goodsInfo.is_check==2?'text-white bg-theme1':'text-333 bg-f8'">库存 </view>
			<!-- 已下架 -->
			<view v-if="pageType=='downIng'"
				class="radius-100 width-160 margin-left-sm  height-56 text-white bg-theme1 text-sm text-center line-height-56"
				@tap='openUp()'>上架 </view>
		</view>
		<!-- 非入仓 失败 -->
		<view class="tools flex  padding justify-center align-center"
			v-if="(goodsInfo.is_check==2&&pageType=='reviewIng')&&userInfo&&userInfo.run_type==2">
			<view class="radius-100 w100  height-72 text-white bg-theme text-sm text-center line-height-72" @tap='editGoods'>
				重新编辑 </view>
		</view>
		<!-- 底部菜单end -->
		<!-- 视频弹框 -->
		<fu-popup ref="coupon" mode="center" width="626rpx" height="600rpx" border-radius="8" :mask-close-able="true"
			v-model="videoPop" @close="videoPop=false">
			<view class="width-626 height-600 bg-white flex align-center justify-center">
				<video v-if="videoPop" :src="goodsInfo.video_url" object-fit='cover' :autoplay='true'
					style="width: 313px;height: 300px;"></video>
			</view>
		</fu-popup>
		<!-- 规则说明 -->
		<fu-popup ref="coupon" mode="center" width="550rpx" height="700rpx" border-radius="8" :mask-close-able="true"
			v-model="couponModel" @close="handleClose">
			<view class="rule-box">
				<view class="rule-box-title solid-bottom">
					{{ruleTitle}}规则说明
				</view>
				<scroll-view class="rule-box-content" scroll-y>
					<jyf-parser :html="rulers"></jyf-parser>
				</scroll-view>
				<view class="rule-box-close solid-top" @click="handleClose">
					{{i18n['关闭']}}
				</view>
			</view>
		</fu-popup>
		<!-- 库存输入弹框 -->
		<fu-popup v-model="isShowStock" mode="center" border-radius="16" :mask-close-able="false">
			<view class="bg-white width-560">
				<view class="text-center padding text-lg text-333">商品库存</view>
				<view class="padding-lr padding-bottom">
					<view class="  text-df text-333">库存数量</view>
					<view class="bg-f8 radius-8 padding-sm text-df margin-top">
						<input type="number" maxlength="6" placeholder="请输入库存数量" v-model="stockIpt"
							placeholder-class="text-df text-999">
					</view>
					<view class="text-sm margin-top">供应总量:1000 </view>
					<view class="text-sm margin-top-sm flex align-center justify-between">
						<text>剩余库存:1000 </text>
						<text>库存下限:1000 </text>
					</view>
				</view>
				<view class="foot solid-top flex align-center justify-between height-100">
					<view class="flex-sub text-gray solid-right text-center" @click="isShowStock=false">取消</view>
					<view class="flex-sub text-theme text-center" @click="handleConfirm">确定</view>
				</view>
			</view>
		</fu-popup>
		<fu-notwork></fu-notwork>
	</view>
</template>

<script>
	import richText from '@/common/utils/richText.js';
	import {
		SHAREURL
	} from '@/common/config.js';
	export default {
		components: {

		},
		data() {
			return {
				videoPop: false, //视频弹框
				stockIpt: '', //库存数量
				StatusBar: this.StatusBar,
				imgWechatUrl: this.imgWechatUrl,
				CustomBar: this.CustomBar,
				isShowStock: false, //库存弹框
				goodsInfo: {}, // {Object}商品信息
				status: '0', //状态
				pageType: '', //'proview' 预览进入 reviewIng审核中 upIng 已上架 downIng已下架
				couponModel: false,
				rulers: '', //规则
				ruleTitle: '', //标题
				configInfo: '', //获取配置信息
			};
		},
		filters: {
			filterMobile(val) {
				if (!val) return '';
				return val.substr(0, 3) + '****' + val.substr(-4);
			}
		},

		computed: {
			// 用户信息
			userInfo() {
				return this.$store.getters.userInfo;
			},
			cartNumber() {
				return this.$store.getters.allNum;
			}
		},
		onReady: function(res) {
			this.videoContext = uni.createVideoContext('myVideo');
		},
		onLoad(options) {
			const {
				id,
				pageType,
				type,
				data
			} = options;
			this.pageType = pageType
			this.goods_id = id;
			if (this.pageType == 'proview') {
				this.goodsInfo = JSON.parse(data)
				this.goodsInfo.video_img = this.goodsInfo.video_url +
					'?x-oss-process=video/snapshot,t_10000,f_jpg,w_800,h_600,m_fast'
				console.log(this.goodsInfo, 'this.goodsInfo');
				this.goodsInfo.ladderList = this.goodsInfo.section_data

			} else {
				this.loadData();
			}
			this.getData()
			uni.$on('refreshAddress', addr_id => {
				this.loadAddress();
			});
			// 监听页面更新
			uni.$on('paySuccess', data => {
				this.loadData(false);
				this.is_showTop = true
			});
		},

		onUnload() {
			uni.$off('refreshAddress')
			uni.$off('paySuccess')
			this.clearPolling();
		},
		filters: {
			filterPrice(price) {
				return parseFloat(price);
			}
		},
		onShow() {
			// this.loadData(false);
		},
		onHide() {
			this.clearPolling();
		},

		methods: {
			/**
			 * @description 获取协议内容
			 * @param {Object} 
			 */
			getData() {
				this.$api.post('/v1/63db2e1c80e82', {
					code: 'config',
				}).then(res => {
					var res = res.data
					if (res.code == 1) {
						this.configInfo = res.data
					} else {
						this.configInfo = ''
					}
				})
			},
			handleClose() {
				this.couponModel = false;
			},
			handleOpen(e) {
				if (e == 1) {
					this.rulers = this.configInfo.cost_price_tip
					this.ruleTitle = '成本价'
				} else if (e == 2) {
					this.rulers = this.configInfo.shop_price_tip
					this.ruleTitle = '售卖价'
				} else if (e == 3) {
					this.rulers = this.configInfo.main_business_price_tip
					this.ruleTitle = '主营价格'
				} else if (e == 4) {
					this.rulers = this.configInfo.vip_price_tip
					this.ruleTitle = 'vip价格'
				} else if (e == 5) {
					this.rulers = this.configInfo.attribute_tip
					this.ruleTitle = '商品属性'
				} else if (e == 6) {
					this.rulers = this.configInfo.min_reserve_tip
					this.ruleTitle = '最小起订量'
				} else if (e == 7) {
					this.rulers = this.configInfo.quota_tip
					this.ruleTitle = '商品限购'
				} else if (e == 8) {
					this.rulers = this.configInfo.section_tip
					this.ruleTitle = '区间价'
				}
				this.couponModel = true;
			},
			delSet() {
				this.$util.showModal({
					title: this.i18n['提示'],
					content: '确定要删除当前内容?',
					confirmColor: this.$store.state.themeColor,
					success: (res) => {
						if (res.confirm) {
							this.$api.post('/v1/63dc72b9dfed0', {
									id: this.goodsInfo.id
								})
								.then(result => {
									if (result.data.code == 1) {
										this.$message.info('删除成功');
										setTimeout(() => {
											uni.navigateBack()
										},100 )
									} else {
										this.$message.info(result.data.msg);
									}
								});
						}
					}

				})
			},
			// 确定输入库存弹框
			handleConfirm() {
				if (this.stockIpt <= 0) {
					return this.$message.info('库存不能小于0')
				}
				// if(this.stockIpt>){
				// 	return this.$message.info('剩余库存不足')
				// }
				this.isShowStock = false
			},
			openPop(item, index) {
				this.isShowStock = true
			},
			/**
			 * @event
			 * @description  播放视频监听
			 * */
			playVideo() {
				this.isPlay = true;
				let that = this;
				setTimeout(() => {
					that.videoContext.requestFullScreen(0);
					that.videoContext.play();
				}, 200);
			},
			/**
			 * @event
			 * @description  视频结束监听
			 * */
			videoEnd(e) {
				this.videoContext.exitFullScreen();
				this.isPlay = false;
			},
			/**
			 * @event
			 * @description  视频全屏监听
			 * */
			fullscreenchange(e) {
				console.log(e);
				// 退出全屏时
				if (!e.detail.fullScreen) {
					this.isPlay = false;
					this.videoContext.pause();
				}
			},
			lookGoodsInfo(type) {
				let data = '';
				if (this.goodsInfo.param || this.goodsInfo.packing) {
					data = (type == 'goods' ? this.goodsInfo.param : this.goodsInfo.packing)
				}
				this.$urouter.navigateTo({
					url: '/pages/index/search/search-list/lookInfo',
					params: {
						pageType: type,
						data: data
					}
				});
			},
			// 配件商品
			toAccessories() {
				this.$urouter.navigateTo({
					url: '/pages/index/search/search-list/accessories',
					params: {
						pageType: 'detail',
						goodsIds: this.goodsInfo.parts_goods_ids
					}
				});
			},
			// 查看评价
			lookEval() {
				this.$urouter.navigateTo({
					url: '/pages/goods/goodsdetail/goods-comment/index',
					params: {
						"goods_id": this.goodsInfo.id,
					}
				})
			},
			// 上架
			openUp() {
				this.$util.showModal({
					title: this.i18n['提示'],
					content: '确定要上架该商品吗?',
					confirmColor: this.$store.state.themeColor,
					success: (res) => {
						if (res.confirm) {
							this.$api.post('/v1/63dc7331c9770', {
									is_sale: 1, //上下架状态 0 下架 1上架
									id: this.goodsInfo.id
								})
								.then(result => {
									if (result.data.code == 1) {
										this.$message.info('上架成功');
									} else {
										this.$message.info(result.data.msg);
									}
								});
						}
					}
				})
			},
			// 编辑
			editGoods() {
				this.$urouter.navigateTo({
					url: '/pages/index/search/search-list/addgoods',
					params: {
						"goods_id": this.goodsInfo.id,
					}
				})
			},
			// 下架
			downLoad() {
				this.$util.showModal({
					title: this.i18n['提示'],
					content: '确定要下架该商品吗?',
					confirmColor: this.$store.state.themeColor,
					success: (res) => {
						if (res.confirm) {
							this.$api.post('/v1/63dc7331c9770', {
									is_sale: 0, // 0 下架 1上架
									id: this.goodsInfo.id
								})
								.then(result => {
									if (result.data.code == 1) {
										this.$message.info('下架成功');
									} else {
										this.$message.info(result.data.msg);
									}
								});
						}
					}

				})
			},

			/**
			 * @event
			 * @description  清除跑马灯轮(暂时用不着)
			 * */
			clearPolling() {
				clearInterval(this.timer);
				clearTimeout(this.outTimer);
			},
			polling() {
				this.outTimer = setTimeout(() => {
					this.lampInfo = null;
				}, 3000);
				this.$api
					.post(global.apiUrls.getGoodsLampList, {
						goods_id: this.goods_id
					})
					.then(res => {
						if (res.data.code == 1 && res.data.data) {
							this.lampInfo = res.data.data;
						}
						// console.log('跑马灯数据', res);
					});
			},

			/**
			 * @event
			 * @description  点击图片放大
			 * @param {String} item 当前图片url
			 * @param {Array} urls 图片url
			 */
			preview(item, urls) {
				uni.previewImage({
					current: item,
					urls: urls
				});
			},
			// 返回
			back() {
				if (this.openModel == 'share') {
					uni.reLaunch({
						url: '/pages/tab/home/shopindex/index'
					});
				} else {
					uni.navigateBack();
				}
			},

			/**
			 * @event
			 * @description  获取商品详情
			 * @param {String} goods_id 商品id
			 * @param {Array} user_id 用户id
			 * @return {Object}
			 */
			loadData(isUpdata) {
				this.$api
					.post('/v1/63db88bfa642a', {
						goods_id: this.goods_id,
						user_id: (global.userInfo && global.userInfo.id) || 0
					})
					.then(res => {
						if (res.data.code == 1) {
							let data = res.data.data;
							this.goodsInfo = data
							this.goodsInfo.video_img = this.goodsInfo.video_url +
								'?x-oss-process=video/snapshot,t_10000,f_jpg,w_800,h_600,m_fast'
							let arr = [{
								price: '',
								min: '',
								max: '',
								name: ''
							}, {
								price: '',
								min: '',
								max: '',
								name: ''
							}, {
								price: '',
								min: '',
								max: '',
								name: ''
							}]
							arr[0].price = data.goods_price.ladder1_price
							arr[0].min = data.goods_price.ladder1_num_min
							arr[0].max = data.goods_price.ladder1_num_max
							arr[0].name = '第一阶梯'

							arr[1].price = data.goods_price.ladder2_price
							arr[1].min = data.goods_price.ladder2_num_min
							arr[1].max = data.goods_price.ladder2_num_max
							arr[1].name = '第二阶梯'
							arr[2].price = data.goods_price.ladder3_price
							arr[2].min = data.goods_price.ladder3_num_min
							arr[2].max = data.goods_price.ladder3_num_max
							arr[2].name = '第三阶梯'
							this.goodsInfo.ladderList = arr

						} else {
							// uni.navigateBack();
							setTimeout(() => {
								this.$message.info(this.i18n['获取详情失败']);
							}, 300);
						}
					});
			},

			/**
			 * @event
			 * @description  收藏
			 * @param {String} collect_id 商品id
			 * @param {Array} sku_id 规格id
			 * @param {Array} collect_title 商品名称
			 * @param {Array} type 类型
			 * @return {Object}
			 */
			collect() {
				this.$util.actionAuth(() => {
					this.$api
						.post(global.apiUrls.postGoodsCollection, {
							collect_id: this.goods_id,
							sku_id: this.sku_id,
							collect_title: this.goodsInfo.name,
							type: 1
						})
						.then(res => {
							if (res.data.code == 1) {
								console.log('collect', res.data);
								if (this.goodsInfo.is_collect) {
									this.goodsInfo.is_collect = 0;
								} else {
									this.goodsInfo.is_collect = 1;
								}
								this.$message.info(res.data.msg);
							}
						});
				});
			},

		},
		onPullDownRefresh() {
			this.loadData(false);
			this.$refs.guess && this.$refs.guess.refresh();

			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom(e) {
			this.$refs.guess && this.$refs.guess.loadData();
		}
	};
</script>

<style lang="scss" scoped>
	page {
		min-height: 100%;
		margin-bottom: 100rpx;
		padding-bottom: calc(100rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
		background-color: #fff;
	}

	.bg-red0 {
		background: rgba(#F02325, 0.1);
	}

	.bg-theme0 {
		background: rgba(#F97F33, 0.1);
	}



	.tools {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background-color: #ffffff;
		/* box-shadow: 0px -1px 0px #eeeeee; */
		z-index: 999;


	}

	// 规则弹窗
	.rule-box {
		width: 100%;
		height: 100%;
		background: #fff;

		.rule-box-title {
			height: 100rpx;
			font-size: 36rpx;
			line-height: 100rpx;
			text-align: center;
			font-weight: bold;
			color: #333;
		}

		.rule-box-content {
			height: calc(100% - 200rpx);
			color: #333;
			padding: 20rpx;
		}

		.rule-box-close {
			height: 100rpx;
			font-size: 32rpx;
			line-height: 100rpx;
			text-align: center;
			color: #333;
		}
	}

	.img-box:nth-child(4n) {
		margin-right: 0 !important;
	}

	/deep/ .uni-numbox__minus {
		background: #fff;
	}

	/deep/ .uni-numbox__plus {
		background: #fff;
	}

	/deep/ .uni-numbox__value {
		background: #F7F7F7;
	}
</style>